<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<%@ page import = "java.sql.*, java.util.*" %>
<%

String jdbcUrl = "jdbc:mysql://localhost/theater?useUnicode=true&characterEncoding=EUC_KR";;
String dbUser = "root";
String dbPass = "apmsetup";


request.setCharacterEncoding("utf-8");

String id = request.getParameter("id");
String password = request.getParameter("password");
String name = request.getParameter("name");
String birth = request.getParameter("birth");
String address = request.getParameter("address");
String phonenumber = request.getParameter("phonenum");
int PrePurchase = 0;
int point =0;
String AdminID = "root";
String VIP = "no";

Connection con = null;
Statement stmt = null;
String sql;

try {
	Class.forName("com.mysql.jdbc.Driver");
	con = DriverManager.getConnection(jdbcUrl, dbUser, dbPass);
	sql = "insert into customer (CustomerID, Password,C_Name,Birth,C_Address,C_Phonenum,PrePurchase,point,AdminID,VIP) values('"+id+"','"+password+"','"+name+"','"+birth+"','"+address+"','"+phonenumber+"','"+PrePurchase+"','"+point+"','"+AdminID+"','"+VIP+"')";
	stmt=con.createStatement();
	
	stmt.executeUpdate(sql);
	
} catch (SQLException e) {
	e.printStackTrace();
} finally {

	if(stmt != null)
		try {
			stmt.close();
		} catch (Exception e) {}
	if(con != null)
		try {
			con.close();
		} catch (Exception e) {}
}
%>
<center>
<h1>회원가입 완료</h1>
<!-- <input type="button" name="sign_in" value="닫기" onclick="javascript:parent.close()"> -->
<input type="button" name="sign_in" value="닫기" onclick="location.href='../sign_in.jsp'">
</center>

</body>
</html>